/*
  ID: nemokin1
  PROG: calfflac
  LANG: C++
*/

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>
 
using namespace std;
 
#define REP(i,n) for(int i=0; i<(n); ++i)
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define FORD(i,a,b) for(int i=(a);i>=b;--i)
#define FOREACH(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define ALL(c) (c).begin(),(c).end()
 
#define debug(x) cerr<< #x << " = " << (x) << "\n";
#define debugv(v) cerr << #v << " = "; FOREACH(it,v) cerr << *it <<","; cerr << "\n";
#define SIZE(a)  (int(a.size()))
 
template<typename T> inline void checkMax(T& a, T b) {if (b>a) a=b;}
template<typename T> inline void checkMin(T& a, T b) {if (b<a) a=b;}
 
typedef long long LL;
typedef vector<int> VI;
typedef vector<string> VS;
typedef long double ld;
const int INF = 1000000000;

int main() {
    freopen("calfflac.in","r",stdin);freopen("calfflac.out","w",stdout);
    string s;
    string sen("");
    
    while(getline(cin,s)) sen+=(s+"\n");
    
    int gstart;
    int gend;
    int glen = 0;
    
    int N = SIZE(sen);
    for(int i = 0; i < N; i++){
	int start = i;
	int end = i;
	int len = 0;
	
	int t = i;
	int q = i;
	for(;;){
	    while(!isalpha(sen[t]) && t >= 0) t--;
	    while(!isalpha(sen[q]) && q < N) q++;
	    if(isalpha(sen[q]) && isalpha(sen[t]) && (tolower(sen[t]) == tolower(sen[q]))){
		start = t;
		end = q;
		len = end-start+1;
		t--;
		q++;
	    }
	    else{
		if(len > glen) {gstart = start;gend = end;glen=len;}
		break;
	    }
	}
    }
    for(int i = 0; i < N; i++){
	int start = i;
	int end = i+1;
	int len = 0;
	
	int t = i;
	int q = i+1;
	for(;;){
	    while(!isalpha(sen[t]) && t >= 0) t--;
	    while(!isalpha(sen[q]) && q < N) q++;
	    if(isalpha(sen[q]) && isalpha(sen[t]) && (tolower(sen[t]) == tolower(sen[q]))){
		start = t;
		end = q;
		len = end-start+1;
		t--;
		q++;
	    }
	    else{
		if(len > glen) {gstart = start;gend = end;glen=len;}
		break;
	    }
	}
    }
    int ret = 0;

    for(int i = gstart; i <= gend; i++) if(isalpha(sen[i])) ret++;
    cout<<ret<<endl;
    cout<<sen.substr(gstart,gend-gstart+1)<<endl;
    exit(0);
}
    
